package cn.uway.service.demo;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.uway.dao.demo.UserDao;
import cn.uway.pojo.demo.UserInfo;
import cn.uway.service.BaseService;

@Transactional
@Service
public class DemoService extends BaseService {

	@Autowired
	private UserDao userDao;
	
	public UserInfo  findUserById(String userId){
		return  userDao.findUserInfo(userId);
	}
	
	public Map<String,Object>  loginCheck(String loginName,  String password){
		UserInfo user = new UserInfo();
		user.setLoginName(loginName);
		user.setPassword(password);
		UserInfo  loginUser =  userDao.login(user);
		if(loginUser==null){
			return this.failRsltMap("用户名或密码错误");
		}
		else{
			return this.successRsltMap("登录成功", loginUser);
		}
	}
}
